<%@ page contentType="text/html;charset=UTF-8"%>
<%@ include file="/WEB-INF/view/include/taglib.jsp"%>
<#if model??>
<html>
<head>
    <title>${model.tableDesc}</title>
    <%@ include file="../<#if model.model!=model.className?uncap_first>../</#if>include/head.jsp"%>
</head>
<body>
<div class="admin-content">
    <div class="admin-content-body">
        <div class="am-g ui-tools">
            <div class="am-u-sm-12 am-u-md-6">
                <div class="am-btn-toolbar">
                    <div class="am-btn-group am-btn-group-xs">
                        <button type="button" class="am-btn am-btn-default" onclick="openModel('新增${model.tableDesc}','${"$"}{ctx}/${model.model}<#if model.model!=model.className?uncap_first>/${model.className?uncap_first}</#if>/create')">
                            <span class="am-icon-plus"></span> 新增
                        </button>
                    </div>
                </div>
            </div>
            <div class="am-u-sm-12 am-u-md-3">
                <form id="searchForm" action="${"$"}{ctx}/${model.model}<#if model.model!=model.className?uncap_first>/${model.className?uncap_first}</#if>" method="post">
                    <input id="pageNo" name="pageNo" type="hidden" value="${"$"}{page.pageNo}"/>
                    <input id="pageSize" name="pageSize" type="hidden" value="${"$"}{page.pageSize}"/>

                    <div class="am-input-group am-input-group-sm">
                        <input type="text" class="am-form-field" name="key" value="${"$"}{page.key}" placeholder="">
                        <span class="am-input-group-btn">
                            <button class="am-btn am-btn-default" type="submit">搜索</button>
                        </span>
                    </div>
                </form>
            </div>
        </div>
        <div class="am-g">
            <div class="am-u-sm-12">
                <form class="am-form">
                    <table id="contentTable" class="am-table am-table-striped am-table-hover table-main">
                        <thead>
                        <tr>
                            <#list model.columns as column>
                                <th>${column.columnDesc}</th>
                            </#list>
                            <th>操作</th>
                        </tr>
                        </thead>
                        <tbody>
                        <c:forEach items="${"$"}{page.list}" var="${model.className?uncap_first}" varStatus="status">
                            <tr>
                                <#list model.columns as column>
                                    <td>${"$"}{${model.className?uncap_first}.${column.columnName?uncap_first}}</td>
                                </#list>
                                <td>
                                    <a href="javascript:;" onclick="openModel('修改${model.tableDesc}','${"$"}{ctx}/${model.model}<#if model.model!=model.className?uncap_first>/${model.className?uncap_first}</#if>/update?id=${"$"}{${model.className?uncap_first}.id}')" title="编辑"><span class="am-icon-pencil"></span></a>
                                    <a href="${"$"}{ctx}/${model.model}<#if model.model!=model.className?uncap_first>/${model.className?uncap_first}</#if>/${"$"}{${model.className?uncap_first}.id}/delete?pageNo=${"$"}{page.pageNo}&pageSize=${"$"}{page.pageSize}" onclick="return confirm('确认要删除该条数据吗？', this.href)" title="删除"><span class="am-text-danger am-icon-trash-o"></span></a></td>
                            </tr>
                        </c:forEach>
                        </tbody>
                    </table>
                </form>
                <%@ include file="../<#if model.model!=model.className?uncap_first>../</#if>utils/pagination.jsp"%>
            </div>
        </div>
    </div>
</div>
<script type="text/javascript">
    $(document).ready(function () {
        var msg = '${"$"}{msg}';
        if(msg!=''){
            showMsg(msg);
        }
    });
</script>
</body>
</html>
</#if>